package com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;

@Entity
@Data
@Table(name = "v_flow_event_union_improve")
@org.hibernate.annotations.Table(appliesTo = "v_flow_event_union_improve",comment = "v_flow_event_union_improve")
public class FlowEventUnionImporove implements Serializable {

    @ApiModelProperty(value = "流程ID")
    @Id
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "process_id", columnDefinition = "varchar(60) comment '唯一编号'")
    private String processId;

    @ApiModelProperty(value = "事件分类 字典")
    @Column(name = "event_class", columnDefinition = "varchar(10) comment '事件分类'")
    private String eventClass;

    @ApiModelProperty(value = "流程创建时间")
    @org.hibernate.annotations.CreationTimestamp
    @Column(name = "process_create_time", columnDefinition = "datetime comment '发起时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime processCreateTime;

    @ApiModelProperty(value = "事件发生时间")
    @Column(name = "event_happen_time", columnDefinition = "datetime comment '事件发生时间'")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd")
    @JsonSerialize(using = LocalDateSerializer.class)
    @JsonDeserialize(using = LocalDateDeserializer.class)
    private LocalDate eventHappenTime;

    /**
     * 流程标题
     */
    @ApiModelProperty(value = "流程标题")
    @Column(name = "process_title", columnDefinition = "varchar(1024) comment '流程标题'")
    String processTitle;

    @ApiModelProperty(value = "系统归属部门")
    @Column(name = "system_belong_department", columnDefinition = "varchar(50) comment '系统归属部门'")
    private String systemBelongDepartment;

    @ApiModelProperty(value = "流程类型")
    @Column(name = "process_define_key", columnDefinition = "varchar(1024) comment '流程定义'")
    String processDefineKey;

    /**
     * 发起人姓名
     */
    @ApiModelProperty(value = "发起人姓名")
    @Column(name = "flow_create_operator_name", columnDefinition = "varchar(30) comment '发起人姓名'")
    String flowCreateOperatorName;


    /**
     * 发起人账号oa
     */
    @ApiModelProperty(value = "发起人账号oa")
    @Column(name = "flow_create_operator_account", columnDefinition = "varchar(30) comment '发起人账户'")
    String flowCreateOperatorAccount;

    /**
     * 系统代码
     */
    @ApiModelProperty(value = "系统代码")
    @Column(name = "system_code", columnDefinition = "varchar(30) comment '系统名称，从it网关取，后续关联团队人员'")
    private String systemCode;

    /**
     *系统管理员账号oa
     */
    @ApiModelProperty(value = "系统管理员账号oa")
    @Column(name = "system_admin_account", columnDefinition = "varchar(30) comment '系统管理员账户'")
    private String systemAdminAccount;

    @ApiModelProperty(value = "是否完成 ")
    @Column(name = "is_close", columnDefinition = "int(2) comment '是否完成0 未完成 1已完成'")
    private int isClose = 0;

    @ApiModelProperty(value = "事件分级 字典")
    @Column(name = "event_grade", columnDefinition = "varchar(10) comment '事件分级'")
    private String eventGrade;

    @ApiModelProperty(value = "待整改措施")
    @Column(name = "improve_count", columnDefinition = "text comment '待整改措施'")
    private String improveCount;

    @ApiModelProperty(value = "全部整改措施数量")
    @Column(name = "improve_count_all", columnDefinition = "text comment '全部整改措施数量'")
    private String improveCountAll;

    @ApiModelProperty(value = "事件成因")
    @Column(name = "event_cause", columnDefinition = "int(2) comment '是否外部0 内部 1外部'")
    private Integer eventCause;
}
